
//在页面加载完毕时，获取列表信息
let v = new Vue({
    el: "#list",
    data: {
        product_arr: [
            // {"id":1, "pImage": "/image/liebiao_xiaomi6.jpg", "pName": "小米6","advantage":"5.16早10点开售","pPrice":"2499.00"},
            // {"id":2, "pImage": "/image/liebiao_xiaomi5c.jpg", "pName": "小米手机5c","advantage":"搭载澎湃S1 八核高性能处理器","pPrice":"1499.00"},
            // {"id":3, "pImage": "/image/liebiao_xiaomint2.jpg", "pName": "小米Note 2","advantage":"5月9日-20日 小米Note 2 享花呗12期分期免息","pPrice":"2799.00"},
            // {"id":4, "pImage": "/image/liebiao_xiaomimix.jpg", "pName": "小米MIX","advantage":"5月9日-20日小米MIX 享花呗12期分期免息","pPrice":"3499.00"},
            // {"id":5, "pImage": "/image/liebiao_xiaomi5s.jpg", "pName": "小米5s","advantage":"暗夜之眼”超感光相机 / 无孔式超声波","pPrice":"1999.00"}
        ],
        pageinfo:[]
    },
    methods:{
        loadProduct: function(pageNum){
            //获取传过来的分类id
            let catagoryId = document.querySelector("#cateId").innerText;
            //发请求到后台获取商品信息
            axios.get("/shoppingsingle/ddProductInfo/getByCategoryId/"+ catagoryId +"/"+ pageNum)
                .then(function(response) {
                    console.log("成功加载数据");
                    console.log(response);
                    v.product_arr = response.data.list;
                    v.pageinfo = response.data;

            })
        }
    },

    /*当页面加载完毕时，会自动调用这个方法（vue对象的生命周期方法）*/
    created: function() {
        this.loadProduct(1);
    }
});













